package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.IMiguMusicRetentConfigDao;
import org.jsbd.boss.domian.MiguMusicRetentConfigBean;
import org.springframework.stereotype.Repository;

@Repository("miguMusicRetentConfigDao")
public class MiguMusicRetentConfigDaoImpl extends CrackBaseDao implements IMiguMusicRetentConfigDao {

	@Override
	public void saveMiguMusicRetentConfig(MiguMusicRetentConfigBean miguMusicRetentConfig) {
		super.insert("migu_music_retent_config.insert_migu_music_retent_config", miguMusicRetentConfig);
	}

	@Override
	public void updateMiguMusicRetentConfig(MiguMusicRetentConfigBean miguMusicRetentConfig) {
		super.insert("migu_music_retent_config.update_migu_music_retent_config", miguMusicRetentConfig);
	}

	@Override
	public MiguMusicRetentConfigBean getMiguMusicRetentConfig(MiguMusicRetentConfigBean miguMusicRetentConfig) {
		return (MiguMusicRetentConfigBean) super.queryForObject("migu_music_retent_config.select_migu_music_retent_config_one", miguMusicRetentConfig);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<MiguMusicRetentConfigBean> getMiguMusicRetentConfigList(MiguMusicRetentConfigBean miguMusicRetentConfig) {
		return super.queryForList("migu_music_retent_config.select_migu_music_retent_config_list", miguMusicRetentConfig);
	}

	@Override
	public Map<String, Object> getMiguMusicRetentConfigListPage(DataGridModel page, MiguMusicRetentConfigBean form) {
		form = (form == null ? new MiguMusicRetentConfigBean() : form);
		form.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("total", super.queryForCount("migu_music_retent_config.select_migu_music_retent_config_page_count", form));
		results.put("rows", super.queryForList("migu_music_retent_config.select_migu_music_retent_config_list", form));
		return results;
	}

	@Override
	public Integer getMiguMusicRetentConfigCount(MiguMusicRetentConfigBean miguMusicRetentConfig) {
		return super.queryForCount("migu_music_retent_config.select_migu_music_retent_config_page_count", miguMusicRetentConfig);
	}

	public void deleteMiguMusicRetentConfig(MiguMusicRetentConfigBean miguMusicRetentConfig){
		super.insert("migu_music_retent_config.del_migu_music_retent_config", miguMusicRetentConfig);
	}

	@Override
	public List<MiguMusicRetentConfigBean> selectByMiguMusicId(Integer id) {
		return super.queryForList("migu_music_retent_config.SELECT_BY_MIGU_MUSIC_ID", id);
	}

	@Override
	public void insertMiguMusicRetentConfig(List<MiguMusicRetentConfigBean> targetList) {
		super.batchInsert("migu_music_retent_config.INSERT_RETENT", targetList);
	}

	@Override
	public void deleteByMiguMusicId(Integer id) {
		super.delete("migu_music_retent_config.DELETE_BY_MIGU_MUSIC_ID", id);
	}

	@Override
	public void saveRetent(List<MiguMusicRetentConfigBean> mvrcs) {
		super.batchInsert("migu_music_retent_config.INSERT_RETENT", mvrcs);
	}

	@Override
	public void deleteRetentBatch(MiguMusicRetentConfigBean mvrcb) {
		super.delete("migu_music_retent_config.DELETE_RETENT_BATCH", mvrcb);
	}

}
